package com.ymttest.database.sqlwapper;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.ymt.database.SqlManager;
import com.ymttest.database.model.Ymt_BlackListForSeller;
import com.ymttest.utils.EnvSetup;

public class YmtBlackListForSellerWapper {
	SqlManager manage;

	public YmtBlackListForSellerWapper() {
		manage = new SqlManager("ymt" + EnvSetup.getEnv());
	}

	/**
	 * 根据Ymt_Orders的iBuyerId,iUserId和Ymt_BlackListForSeller的iAction查找记录
	 * 
	 * @return
	 */
	public List<Map> selectRecordsBySellerBuyerAction(Object iBuyerId,
			Object iUserId, Object iAction) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("iBuyerId", iBuyerId);
		map.put("iUserId", iUserId);
		map.put("iAction", iAction);
		List<Map> addressList = manage
				.getSelectResults(
						"com.ymttest.database.mapping.YmtBlackListForSellerMapper.selectRecordsBySellerBuyerAction",
						map);
		manage.commit();
		return addressList;
	}

	public void close() {
		manage.close();
	}

	/**
	 * 
	 * @param queryField
	 *            查询的字段
	 * @param joinCondition
	 *            连表查询
	 * @param queryCondition
	 *            查询条件
	 * @return
	 */
	@SuppressWarnings("rawtypes")
	public List<Ymt_BlackListForSeller> selectBlackListForSeller(
			String queryField, String joinCondition, String queryCondition) {
		Map m = new HashMap();
		if (null != queryField && !"".equals(queryField)) {
			m.put("queryField", queryField);
		}
		if (null != joinCondition && !"".equals(joinCondition)) {
			m.put("joinCondition", joinCondition);
		}
		if (null != queryCondition && !"".equals(queryCondition)) {
			m.put("queryCondition", queryCondition);
		}
		return (List<Ymt_BlackListForSeller>) manage
				.getSelectResults(
						"com.ymttest.database.mapping.YmtBlackListForSellerMapper.selectBlackListForSeller",
						m);
	}
	
	public static void main(String[] args) {
		YmtBlackListForSellerWapper wap = new YmtBlackListForSellerWapper();
		List<Ymt_BlackListForSeller> l = wap.selectBlackListForSeller(" top 1 *", null, "1=1");
		System.out.println(l.get(0).getsBlackListId());
	}

}
